#!/bin/bash

# 机械臂守护进程管理脚本

case "$1" in
    start)
        echo "🚀 启动机械臂守护进程..."
        sudo systemctl start robotic-arm
        ;;
    stop)
        echo "🛑 停止机械臂守护进程..."
        sudo systemctl stop robotic-arm
        ;;
    restart)
        echo "🔄 重启机械臂守护进程..."
        sudo systemctl restart robotic-arm
        ;;
    status)
        echo "📊 服务状态:"
        sudo systemctl status robotic-arm
        ;;
    logs)
        echo "📝 查看日志:"
        sudo journalctl -u robotic-arm -f
        ;;
    enable)
        echo "🔧 启用自启动..."
        sudo systemctl enable robotic-arm
        ;;
    disable)
        echo "🔧 禁用自启动..."
        sudo systemctl disable robotic-arm
        ;;
    *)
        echo "🤖 机械臂守护进程管理脚本"
        echo "用法: $0 {start|stop|restart|status|logs|enable|disable}"
        echo ""
        echo "start   - 启动服务"
        echo "stop    - 停止服务"
        echo "restart - 重启服务"
        echo "status  - 查看状态"
        echo "logs    - 查看日志"
        echo "enable  - 启用自启动"
        echo "disable - 禁用自启动"
        exit 1
        ;;
esac